package com.yanghui.dtracing.plugin.spring;

import com.yanghui.dtracing.core.constant.TypeEnum;
import com.yanghui.dtracing.core.opentracing.DTracerTags;
import com.yanghui.dtracing.core.plugin.interceptor.AbstractInstanceMethodInterceptor;
import com.yanghui.dtracing.core.plugin.interceptor.MethodInterceptResult;
import io.opentracing.Span;
import io.opentracing.tag.Tags;

import java.lang.reflect.Method;

public class SpringInstanceMethodAroundInterceptor extends AbstractInstanceMethodInterceptor {

    @Override
    protected void doBeforeMethod(Object thisObj, Method method, Object[] allArguments, MethodInterceptResult result, Span span) throws Throwable {
        span.setTag(Tags.COMPONENT, DTracerTags.COMPONENT_SPRING)
                .setTag(DTracerTags.TYPE, TypeEnum.LOCAL.getName());
    }
}
